package com.game.service.game.turntable.control;

import com.game.service.windows.LogWindows;

import java.util.ArrayList;
import java.util.Arrays;

public class GameRunInfo {
    private long gameBetTotal;//游戏内总投注
    private long gamePrizeTotal;//游戏内总开奖
    private long dailySendDiamond;//每日活动赠送的钻石
    private long luckyStoreExDiamond;//幸运商店兑换的钻石
    private int playCounts;//游戏总次数;
    private int prizeCounts;//赠送奖励次数;

    private int[] betCount = new int[10 + 10];//押注统计(富余10个，之后可以兼容增加)
    private int[] prizeItemCount = new int[16];//出奖统计
    private int[] prizeItemConfigCount = new int[16];//配置产生的数据


    private ConfigBenefit configBenefitKill = new ConfigBenefit();
    private ConfigBenefit configBenefitProtect = new ConfigBenefit();
    private ConfigBenefit configBenefitSaving = new ConfigBenefit();


    public void setGameBetTotalAdd(long gameBetTotal) {
        this.gameBetTotal += gameBetTotal;
    }

    public void setGamePrizeTotalAdd(long gamePrizeTotal) {
        this.gamePrizeTotal += gamePrizeTotal;
    }


    public long getDailySendDiamond() {
        return dailySendDiamond;
    }

    public void setDailySendDiamondAdd(long dailySendDiamond) {
        this.dailySendDiamond += dailySendDiamond;
    }

    public long getLuckyStoreExDiamond() {
        return luckyStoreExDiamond;
    }

    public void setLuckyStoreExDiamondAdd(long luckyStoreExDiamond) {
        this.luckyStoreExDiamond += luckyStoreExDiamond;
    }

    public int getPlayCounts() {
        return playCounts;
    }

    public void setPlayCounts(int playCounts) {
        this.playCounts = playCounts;
    }


    //系统盈利
    public long getSystemWin() {
        return gameBetTotal - gamePrizeTotal;
    }

    //实际系统盈利
    public long getActualSystemWin() {
        return gameBetTotal - gamePrizeTotal - dailySendDiamond - luckyStoreExDiamond;
    }

    //游戏返奖率
    public float getGamePayoutRate() {
        return (float) (gamePrizeTotal * 100) / gameBetTotal;
    }

    //实际返奖率
    public float getActualPayoutRate() {
        return ((float) (dailySendDiamond + luckyStoreExDiamond + gamePrizeTotal) * 100) / gameBetTotal;
    }


    public void print() {
        String log1 = String.format("系统盈利:%s,系统返奖率:%s\n", getActualSystemWin(), String.format("%.2f", getActualPayoutRate()) + "%");
        String log2 = String.format("游戏盈利:%s,游戏返奖率:%s\n", getSystemWin(), String.format("%.2f", getGamePayoutRate()) + "%");
        String log3 = String.format("累计下注:%s,开奖:%s\n", gameBetTotal, gamePrizeTotal);
        String log4 = String.format("活动赠送:%s,兑换:%s\n", getDailySendDiamond(), getLuckyStoreExDiamond());
        String log5 = String.format("奖项次数,大到小:%s,游玩次数:%s,赠送奖励次数:%s\n", Arrays.toString(prizeItemCount), playCounts, prizeCounts);
        String log6 = String.format("保护抽杀:大到小%s\n", Arrays.toString(prizeItemConfigCount));
        String log7 = String.format("押注次数,小到大:%s\n", Arrays.toString(betCount));

        String logCon1 = String.format("抽杀设置,收益:%s\n", configBenefitKill);
        String logCon2 = String.format("保护设置,赠送:%s\n", configBenefitProtect);
        String logCon3 = String.format("拯救设置,赠送:%s\n", configBenefitSaving);
        String printLog1=log1 + log2 + log3 + log4 + log5 + log6 + log7;
        String printLog2=logCon1 + logCon2 + logCon3;
        String printLogAll="查看盈利\n"+printLog1+printLog2;
        LogWindows.getLogWindows().printToTextArea(printLogAll,GameRunInfo.class);


    }

    public int[] getPrizeItemCount() {
        return prizeItemCount;
    }

    public void setPrizeItemCount(int[] prizeItemCount) {
        this.prizeItemCount = prizeItemCount;
    }

    public int[] getBetCount() {
        return betCount;
    }

    public void setBetCount(int[] betCount) {
        this.betCount = betCount;
    }

    public int[] getPrizeItemConfigCount() {
        return prizeItemConfigCount;
    }

    public void setPrizeItemConfigCount(int[] prizeItemConfigCount) {
        this.prizeItemConfigCount = prizeItemConfigCount;
    }

    public ConfigBenefit getConfigBenefitKill() {
        return configBenefitKill;
    }

    public void setConfigBenefitKill(ConfigBenefit configBenefitKill) {
        this.configBenefitKill = configBenefitKill;
    }

    public ConfigBenefit getConfigBenefitProtect() {
        return configBenefitProtect;
    }

    public void setConfigBenefitProtect(ConfigBenefit configBenefitProtect) {
        this.configBenefitProtect = configBenefitProtect;
    }

    public ConfigBenefit getConfigBenefitSaving() {
        return configBenefitSaving;
    }

    public void setConfigBenefitSaving(ConfigBenefit configBenefitSaving) {
        this.configBenefitSaving = configBenefitSaving;
    }


    public int getPrizeCounts() {
        return prizeCounts;
    }

    public void setPrizeCounts(int prizeCounts) {
        this.prizeCounts = prizeCounts;
    }
}
